
namespace Needle.Bus.Engine
{
    /// <summary>
    /// This interface defines if a component is currently active or idle.
    /// It is intended as a cooperative, lightweight locking mechanism.
    /// </summary>
    public interface IIsActive
    {
        /// <summary>
        /// True if the component is active. This property should only be used 
        /// to sample the active status of the component, not to make decisions.
        /// </summary>
        bool IsActive { get; }

        /// <summary>
        /// Set the component in the active state, returns true if the  
        /// component was activated by this call, false if it was already active.
        /// </summary>
        bool Activate();

        /// <summary>
        /// Set the component in the passive state, should be called by the 
        /// component that called Activate()
        /// </summary>
        void Deactivate();
    }
}
